﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Remoting.Contexts;
using System.Runtime.Remoting.Messaging;

namespace _1Dot9MasterTransactions
{
    internal class TransactionalContextProperty : IContextProperty, IContributeObjectSink
    {
        // Fields
        internal static string ContextPropertyName = "TransactionalContextProperty";

        // Methods
        void IContextProperty.Freeze(Context newContext)
        {
        }

        bool IContextProperty.IsNewContextOK(Context newCtx)
        {
            return true;
        }

        IMessageSink IContributeObjectSink.GetObjectSink(MarshalByRefObject obj, IMessageSink nextSink)
        {
            return new TransactionalServerObjectSink(obj, nextSink);
        }

        // Properties
        string IContextProperty.Name
        {
            get
            {
                return ContextPropertyName;
            }
        }
    }
}
